package leetcode

func twoSumMethod1(nums []int, target int) []int {

	for k, v := range nums[:len(nums)-1] {
		for kk, vv := range nums[k+1:] {
			if v+vv == target {
				return []int{k, kk + k + 1}
			}
		}
	}

	return []int{}
}

func twoSumMethod2(nums []int, target int) []int {

	h := map[int]int{}

	for k, v := range nums {
		if t, ok := h[target-v]; ok {
			return []int{t, k}
		}
		h[v] = k
	}

	return []int{}
}
